- drawing of three dimensional Velocity Fields in Xi -
The command velocity_field3d plots a 3 dimensional velocity field with arrows pointing in the direction of the given velocity field. The length of an arrow is proportional to the strength of the field. This command is completly written in Xi. Have a look at the code.
The velocity field is defined by three 3-dimensional arrays u, v and w containing the X, Y and Z components of the velocity field.
( 1)>u=replicate(cos(dincarr(4,4)/5.),4); ( 2)>v=replicate(transpose(sin(dincarr(4,4)/5.)),4); ( 3)>w=darr(4,4,4)+0.4 ( 4)>window(0,\t3d); ( 5)>velocity_field3d(u,v,w); Function arrowHead3d defined Function velocity_field3d defined Function error defined ( 6)>plot3d(\angle={60,30,-90});Just as a reminder: Pressing the left or right mouse button in the X11-window rotates the plot.
The arrows might be to short. Click the ClearAll in the Edit menu to clear the window.
( 7)>velocity_field3d(u,v,w,\nsteps=10,\stepSize=0.02);By default each arrow has only one segment with length 0.1. You can change the number of segments in each arrow with the parameter nsteps and the length of each segment with stepSize.
Additional you can determine the abscissa and ordinate values by using the paramters x, y and z. Here x,y and z must be vectors, the size of z must be equal to the first dimension of u, v, w and y must be equal to the secound dimension of u, v, w. At least the size of x must be equal to the third dimension of u, v, w.
Determine the starting points of each arrow with the parameters startX, startY and startZ.
( 8)>startX={0,0,0,1,1.2}; ( 9)>startZ={0,0,0,0,0}; ( 10)>startY={0,1,2,2,0}; ( 11)>colors={4,4,4,4,4}; ( 11)>velocity_field3d(u,v,w,\startX=startX,\startY=startY,\startZ=startZ, \nsteps=200,\stepSize=0.01,\headScale=0.1,\color=colors); ( 12)>plot3d(\zrange={0,2});Now make a povray file of this velocity field. Use the POV Output buttom of the X11-window to generate the povray file. The result looks like this (after using the crop function)